package com.yicong.ants.bean.base;


import com.yicong.ants.bean.common.PageInfoBean;

import java.util.ArrayList;
import java.util.List;

/**
 * description 服务器响应的数据
 * author  cchao
 * date  2017/2/24
 **/
public class ArrayListRespBean<T> extends BaseBean {

    public PageInfoBean pageInfo;
    int current_page;
    int last_page;
    private ArrayList<T> data;

    public ArrayListRespBean() {
    }

    public ArrayList<T> getData() {
        return data;
    }

    public int getCurrent_page() {
        return pageInfo != null ? pageInfo.getCurPage() : current_page;
    }

    public int getLast_page() {
        return pageInfo != null ? pageInfo.getCountPage() : last_page;
    }

    public PageInfoBean getPageInfo() {
        return this.pageInfo;
    }

    public void setPageInfo(PageInfoBean pageInfo) {
        this.pageInfo = pageInfo;
    }

    public void setCurrent_page(int current_page) {
        this.current_page = current_page;
    }

    public void setLast_page(int last_page) {
        this.last_page = last_page;
    }

    public void setData(ArrayList<T> data) {
        this.data = data;
    }

    public boolean equals(final Object o) {
        if (o == this) return true;
        if (!(o instanceof ArrayListRespBean)) return false;
        final ArrayListRespBean<?> other = (ArrayListRespBean<?>) o;
        if (!other.canEqual((Object) this)) return false;
        if (!super.equals(o)) return false;
        final Object this$pageInfo = this.getPageInfo();
        final Object other$pageInfo = other.getPageInfo();
        if (this$pageInfo == null ? other$pageInfo != null : !this$pageInfo.equals(other$pageInfo))
            return false;
        if (this.getCurrent_page() != other.getCurrent_page()) return false;
        if (this.getLast_page() != other.getLast_page()) return false;
        final Object this$data = this.getData();
        final Object other$data = other.getData();
        if (this$data == null ? other$data != null : !this$data.equals(other$data)) return false;
        return true;
    }

    protected boolean canEqual(final Object other) {
        return other instanceof ArrayListRespBean;
    }

    public int hashCode() {
        final int PRIME = 59;
        int result = super.hashCode();
        final Object $pageInfo = this.getPageInfo();
        result = result * PRIME + ($pageInfo == null ? 43 : $pageInfo.hashCode());
        result = result * PRIME + this.getCurrent_page();
        result = result * PRIME + this.getLast_page();
        final Object $data = this.getData();
        result = result * PRIME + ($data == null ? 43 : $data.hashCode());
        return result;
    }

    public String toString() {
        return "ListRespBean(pageInfo=" + this.getPageInfo() + ", current_page=" + this.getCurrent_page() + ", last_page=" + this.getLast_page() + ", data=" + this.getData() + ")";
    }
}
